package com.zrrd.io.charStream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title FileReaderDemo01
 * @description
 * @create 2023/10/14 17:09
 */
public class FileReaderDemo01 {
    public static void main(String[] args) throws IOException {
        FileReader reader = new FileReader("D:/abc.txt");
        //读取一个字符
        //int read = reader.read();
        //System.out.println((char) read);
        //读取一个字符串（字符数组）
        char[] chars=new char[1024];
        int length=0;
        while ((length=reader.read(chars))!=-1){
            System.out.println(new String(chars,0,length));
        }
    }
}
